//
//  ChooseCell.swift
//  DSP
//
//  Created by tucici on 2024/5/24.
//

import UIKit
import TCCKit
class ChooseCell: UICollectionViewCell {
    private var name : UILabel!
    var isenable : Bool = false
    var line : UIView!
    var line2 : UIView!
    override init(frame: CGRect) {
        super.init(frame: frame)
        initUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func initUI(){
        backgroundColor = .clear
        
        name = UILabel()
        name.text = ""
        name.font = font(16)
        name.textAlignment = .center
        name.textHexColor = HEX_BLACK
        
        line = UIView()
        line.bgHexColor = HEX_BLACK
        
        line2 = UIView()
        line2.bgHexColor = HEX_BLACK
        
        contentView.addSubview(name)
        contentView.addSubview(line)
        contentView.addSubview(line2)
        
        name.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        line.snp.makeConstraints { make in
            make.left.right.bottom.equalToSuperview()
            make.height.equalTo(0.5)
        }
        
        line2.snp.makeConstraints { make in
            make.top.bottom.right.equalToSuperview()
            make.width.equalTo(0.5)
        }
    }
    
    var model : ChannelModel!{
        didSet{
            name.text = model.name
            switch (isenable){
            case false:
                name.bgHexColor = HEX_BG
                name.textHexColor = HEX_GRAY1
            case true:
                name.bgHexColor = model.select ? HEX_RED :  HEX_WHITE
                name.textHexColor = HEX_BLACK
            }
        }
    }
    
}
